home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus 2002 #11 / Amiga Plus CD - 2002 - No. 11.iso / Tools / Development / PowerD / alpha / modules / powerpc / powerpc.m < prev    next >
Encoding:
Text File  |  2002-10-28  |  7.2 KB  |  197 lines

  1. MODULE  'exec/libraries'
  2.  
  3. #define POWERPCNAME 'powerpc.library'
  4.  
  5. OBJECT PPCBase
  6.   LibNode:Library,
  7.   SysLib:APTR,
  8.   DosLib:APTR,
  9.   SegList:APTR,
  10.   NearBase:APTR,
  11.   Flags:UBYTE,
  12.   DosVer:UBYTE
  13.  
  14. /* tagitem values for GetHALInfo (V14+) */
  15. #define HINFO_TAGS             (TAG_USER+$103000)
  16. #define HINFO_ALEXC_HIGH       (HINFO_TAGS+0)     /* High word of emulated
  17.                                                     alignment exceptions */
  18. #define HINFO_ALEXC_LOW        (HINFO_TAGS+1)     /* Low word of ... */
  19. /* tagitem values for SetScheduling (V14+) */
  20. #define SCHED_TAGS             (TAG_USER+$104000)
  21. #define SCHED_REACTION         (SCHED_TAGS+0)     /* reaction of low activity tasks */
  22. /* tagitem values for GetInfo */
  23. #define GETINFO_TAGS     (TAG_USER+$102000)
  24. #define GETINFO_CPU      (GETINFO_TAGS+0)   /* CPU type (see below) */
  25. #define GETINFO_PVR      (GETINFO_TAGS+1)   /* PVR type (see below) */
  26. #define GETINFO_ICACHE   (GETINFO_TAGS+2)   /* Instruction cache state */
  27. #define GETINFO_DCACHE   (GETINFO_TAGS+3)   /* Data cache state */
  28. #define GETINFO_PAGETABLE  (GETINFO_TAGS+4)   /* Page table location */
  29. #define GETINFO_TABLESIZE  (GETINFO_TAGS+5)   /* Page table size */
  30. #define GETINFO_BUSCLOCK  (GETINFO_TAGS+6)    /* PPC bus clock */
  31. #define GETINFO_CPUCLOCK  (GETINFO_TAGS+7)    /* PPC CPU clock */
  32. #define GETINFO_CPULOAD  (GETINFO_TAGS+8)   /* Total CPU usage */
  33. #define GETINFO_SYSTEMLOAD  (GETINFO_TAGS+9)  /* Total system usage */
  34. /* PPCINFO_ICACHE / PPCINFO_DCACHE */
  35.  
  36. FLAG CACHE_ON_UNLOCKED=0,
  37.  CACHE_ON_LOCKED=1,
  38.  CACHE_OFF_UNLOCKED=2,
  39.  CACHE_OFF_LOCKED=3
  40.  
  41. FLAG CPU_603=4,
  42.  CPU_603E=8,
  43.  CPU_604=12,
  44.  CPU_604E=16,
  45.  CPU_620=20,
  46.  CPU_G3=21,  /* added by DMX */
  47.  CPU_G4=22,  /* added by DMX */
  48.  CPU_G5=23  /* added by DMX */
  49.  
  50. OBJECT PPCArgs
  51.   Code:APTR,           /* Code Entry / Basevariable (OS Callback) */
  52.   Offset:LONG,        /* Offset into Library-Jumptable (OS Callback) */
  53.   Flags:ULONG,        /* see below */
  54.   Stack:APTR,          /* Pointer to first argument to be copied or NULL */
  55.   StackSize:ULONG,    /* Size of stack area to be copied or 0 */
  56.   Regs[15]:ULONG,     /* Registervalues to be transferred */
  57.   FRegs[8]:DOUBLE     /* FPU Registervalues to be transferred */
  58.  
  59. /* PP_Flags */
  60. CONST PPF_ASYNC=(1<<0),   /* call PPC/68K asynchron */
  61.  PPF_LINEAR=(1<<1),   /* pass r3-r10/f1-f8 (V15+) */
  62.  PPF_THROW=(1<<2)   /* throw exception before entering function */
  63. /* status returned by RunPPC, WaitForPPC, Run68K and WaitFor68K */
  64.  
  65. ENUM PPERR_SUCCESS, /* success */
  66.  PPERR_ASYNCERR,  /* synchron call after asynchron call */
  67.  PPERR_WAITERR   /* WaitFor[PPC/68K] after synchron call */
  68. /* Offsets into the RegisterArrays.for 68K Callbacks */
  69.  
  70. ENUM PPREG_D0,
  71.  PPREG_D1,
  72.  PPREG_D2,
  73.  PPREG_D3,
  74.  PPREG_D4,
  75.  PPREG_D5,
  76.  PPREG_D6,
  77.  PPREG_D7,
  78.  PPREG_A0,
  79.  PPREG_A1,
  80.  PPREG_A2,
  81.  PPREG_A3,
  82.  PPREG_A4,
  83.  PPREG_A5,
  84.  PPREG_A6
  85.  
  86. ENUM PPREG_FP0,
  87.  PPREG_FP1,
  88.  PPREG_FP2,
  89.  PPREG_FP3,
  90.  PPREG_FP4,
  91.  PPREG_FP5,
  92.  PPREG_FP6,
  93.  PPREG_FP7
  94. #ifndef POWERPCLIB_V7
  95. /* use max. version 7 of powerpc.library -> */
  96. /* ppc.library can be used instead of WarpKernal */
  97. /* V7 is recommended for "simple" applications */
  98. /* Cache flags (required by SetCache/SetCache68K) */
  99. ENUM CACHE_DCACHEOFF=1,
  100.  CACHE_DCACHEON,
  101.  CACHE_DCACHELOCK,
  102.  CACHE_DCACHEUNLOCK,
  103.  CACHE_DCACHEFLUSH,
  104.  CACHE_ICACHEOFF,
  105.  CACHE_ICACHEON,
  106.  CACHE_ICACHELOCK,
  107.  CACHE_ICACHEUNLOCK,
  108.  CACHE_ICACHEINV,
  109.  CACHE_DCACHEINV
  110. /* Hardware flags (required by SetHardware) */
  111. ENUM HW_TRACEON=1,              /* enable singlestep mode */
  112.  HW_TRACEOFF,                    /* disable singlestep mode */
  113.  HW_BRANCHTRACEON,               /* enable branch trace mode */
  114.  HW_BRANCHTRACEOFF,              /* disable branch trace mode */
  115.  HW_FPEXCON,                     /* enable FP exceptions */
  116.  HW_FPEXCOFF,                    /* disable FP exceptions */
  117.  HW_SETIBREAK,                   /* set instruction breakpoint */
  118.  HW_CLEARIBREAK,                 /* clear instruction breakpoint */
  119.  HW_SETDBREAK,                   /* set data breakpoint (604[E] only) */
  120.  HW_CLEARDBREAK                 /* clear data breakpoint (604[E] only) */
  121. /* return values of SetHardware */
  122. ENUM HW_AVAILABLE=-1,               /* feature available */
  123.  HW_NOTAVAILABLE               /* feature not available */
  124. /* return values of GetPPCState */
  125. FLAG PPCSTATE_POWERSAVE=0,              /* PPC is in power save mode */
  126.  PPCSTATE_APPACTIVE=1,              /* PPC application tasks are active */
  127.  PPCSTATE_APPRUNNING=2              /* PPC application task is running */
  128. /* FP flags (required by ModifyFPExc) */
  129.  
  130. FLAG FP_EN_OVERFLOW=0,         /* enable overflow exception */
  131.  FP_EN_UNDERFLOW=1,         /* enable underflow exception */
  132.  FP_EN_ZERODIVIDE=2,         /* enable zerodivide exception */
  133.  FP_EN_INEXACT=3,         /* enable inexact op. exception */
  134.  FP_EN_INVALID=4,         /* enable invalid op. exception */
  135.  FP_DIS_OVERFLOW=5,         /* disable overflow exception */
  136.  FP_DIS_UNDERFLOW=6,         /* disable underflow exception */
  137.  FP_DIS_ZERODIVIDE=7,         /* disable zerodivide exception */
  138.  FP_DIS_INEXACT=8,         /* disable inexact op. exception */
  139.  FP_DIS_INVALID=9         /* disable invalid op. exception */
  140.  
  141. CONST FPF_ENABLEALL=$0000001f,     /* enable all FP exceptions */
  142.  FPF_DISABLEALL=$000003e0     /* disable all FP exceptions */
  143. /* tags passed to SetExcHandler (exception handler attributes) */
  144. #define EXCATTR_TAGS     (TAG_USER+$101000)
  145. #define EXCATTR_CODE     (EXCATTR_TAGS+0)   /* exception code (required) */
  146. #define EXCATTR_DATA     (EXCATTR_TAGS+1)   /* exception data */
  147. #define EXCATTR_TASK     (EXCATTR_TAGS+2)   /* ppc task address (or NULL) */
  148. #define EXCATTR_EXCID    (EXCATTR_TAGS+3)   /* exception ID */
  149. #define EXCATTR_FLAGS    (EXCATTR_TAGS+4)   /* see below */
  150. #define EXCATTR_NAME     (EXCATTR_TAGS+5)   /* identification name */
  151. #define EXCATTR_PRI      (EXCATTR_TAGS+6)   /* handler priority */
  152. /* EXCATTR_FLAGS (either EXC_GLOBAL or EXC_LOCAL, resp. */
  153. /*                EXC_SMALLCONTEXT or EXC_LARGECONTEXT must be */
  154. /*                specified) */
  155. FLAG EXC_GLOBAL=0,        /* global handler */
  156.  EXC_LOCAL=1,        /* local handler */
  157.  EXC_SMALLCONTEXT=2,        /* small context structure */
  158.  EXC_LARGECONTEXT=3,        /* large context structure */
  159.  EXC_ACTIVE=4        /* private */
  160. /* EXCATTR_EXCID (Exception ID) */
  161. FLAG EXC_MCHECK=2,              /* machine check exception */
  162.  EXC_DACCESS=3,              /* data access exception */
  163.  EXC_IACCESS=4,              /* instruction access exception */
  164.  EXC_INTERRUPT=5,             /* external interrupt (V15+) */
  165.  EXC_ALIGN=6,              /* alignment exception */
  166.  EXC_PROGRAM=7,              /* program exception */
  167.  EXC_FPUN=8,              /* FP unavailable exception */
  168.  EXC_SC=12,             /* system call exception */
  169.  EXC_TRACE=13,             /* trace exception */
  170.  EXC_PERFMON=15,             /* performance monitor exception */
  171.  EXC_IABR=19             /* IA breakpoint exception */
  172.  
  173. OBJECT EXCContext
  174.  ExcID:ULONG,
  175.  [CUNION
  176.   SRR0:ULONG,
  177.   PC:APTR
  178.  ENDUNION]:UPC,
  179.  SRR1:ULONG,
  180.  DAR:ULONG,
  181.  DSISR:ULONG,
  182.  CR:ULONG,
  183.  CTR:ULONG,
  184.  LR:ULONG,
  185.  XER:ULONG,
  186.  FPSCR:ULONG,
  187.  GPR[32]:ULONG,
  188.  FPR[32]:DOUBLE
  189.  
  190. OBJECT XContext
  191.   ExcID:ULONG,
  192.   R3:ULONG
  193.  
  194. ENUM EXCRETURN_NORMAL, /* allow the next exc handlers to complete */
  195.  EXCRETURN_ABORT       /* exception is immediately leaved, all */
  196.                        /* other exception handlers are ignored */
  197.